package steed.hadmin.tag;

import javax.servlet.jsp.JspException;

import steed.tag.BaseTag;

/**
 * 设置BootstrapTable操作按钮
 * @author 战马
 *
 */
public class TableButton extends BaseTag{
	private static final long serialVersionUID = 1L;
	
	private boolean add = true;
	private boolean edit = true;
	private boolean delete = true;
	private boolean searchForm = true;

	public void setAdd(boolean add) {
		this.add = add;
	}

	public void setSearchForm(boolean searchForm) {
		this.searchForm = searchForm;
	}

	public void setEdit(boolean edit) {
		this.edit = edit;
	}

	public void setDelete(boolean delete) {
		this.delete = delete;
	}

	@Override
	public int doStartTag() throws JspException {
		writeFile("btnGroupBegin");
		if (add) {
			writeFile("add");
		}
		if (edit) {
			writeFile("edit");
		}
		if (delete) {
			writeFile("delete");
		}
		if (searchForm) {
			writeFile("searchFormBegin");
		}
		return EVAL_BODY_INCLUDE;
	}

	@Override
	public int doEndTag() throws JspException {
		if (searchForm) {
			writeFile("searchFormEnd");
		}
		writeFile("btnGroupEnd");
		return EVAL_PAGE;
	}
	
	
}
